﻿
@{
    string url = ViewBag.url;
}
@if (!string.IsNullOrEmpty(url))
{
    // SEO contentn
    // @RenderPage(url);
}

    <style>
        #content {
            width: 100%;
            border: 0;
            padding: 0;
            margin: 0;
            min-height: 1000px;
            background-color: #FFF;
            overflow: hidden;
        }

    </style>
    <iframe id="content" src=""></iframe>
    <script type="text/javascript">
        function getParameter(paramstr) {
            var urlStr = paramstr || window.location.search,
                param = {};

            if (urlStr) {
                var urlArr = urlStr.split("?")[1].split("&");

                for (var i = urlArr.length - 1; i >= 0; i--) {
                    var tempArr = urlArr[i].split("=");
                    param[tempArr[0]] = decodeURIComponent(tempArr[1]);
                }
                return param;
            }
            return {};
        }
        $(function () {
            // var param = getParameter(window.location.search)
            var param = {
                _content: '@url',
                _search: ''
            }
            var search = param._content.indexOf('?')
            if (search > -1) {
                param._search = param._content.substr(search+1)
            }
            url = param._content.replace(/\.html$/i, '') + (param._search.length > 0 ? ('?' + param._search) : '')

            $('#content').prop('src', '/Content/pages/' + url)

            var _prevHei = 0,
                setIframeHeight = function (iframe) {
                if (iframe) {
                    var iframeWin = iframe.contentWindow || iframe.contentDocument.parentWindow;
                    if (iframeWin.document.body) {
                        var hei = iframeWin.document.documentElement.scrollHeight || iframeWin.body.scrollHeight;
                        if (hei != _prevHei) {
                            iframe.height = hei
                        }
                    }
                }
                setTimeout(setIframeHeight, 100, iframe)
            }
            setIframeHeight($('#content')[0])
        })

    </script>